//package cn.java75.sp.inter;
//
//import org.springframework.web.servlet.ModelAndView;
//import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * @author oldliu
// * @since 1.0
// */
//public class TimeInterceptor extends HandlerInterceptorAdapter {
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        request.setAttribute("start",System.nanoTime());
//        return true;
//        // return super.preHandle(request, response, handler);
//    }
//
//    @Override
//    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//        //super.postHandle(request, response, handler, modelAndView);
//        System.out.println("对象是"+handler+","+request.getServletPath()+",返回值是"+modelAndView);
//    }
//
//    @Override
//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//        //super.afterCompletion(request, response, handler, ex);
//        long end=System.nanoTime();
//        long start= (long) request.getAttribute("start");
//        System.out.println(request.getServletPath()+"执行时间是"+(end-start)+"纳秒");
//    }
//}
